/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bddfirstproject.view.renderer;

import bddfirstproject.model.PartieRedaction;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

/**
 *
 * @author epulapp
 */
public class ArticleJTree extends JTree {
    
    @Override
    public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)  {
        // Surcharge de l'affichage des objets du JTree
        DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) value;
        if(currentNode.getUserObject() instanceof PartieRedaction) {
            PartieRedaction currentPartie = (PartieRedaction) currentNode.getUserObject();
            return currentPartie.getTitrePartie();
        } else {
            return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
        }
    }
}
